﻿//***********************************************************************
// * Module:   TbBstOnlineAskManagement
// * 作者:  曹荣芝
// * Modified: 2013/5/5
// * Purpose: Definition of the Class TbBstOnlineAskManagement
// ***********************************************************************/

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using XWG;
using XWG.JWBST;
using XWG.JWBST.JWBSTEntity;
using XWG.JWBST.JWBSTBLL;
using XWG.JWBST.JWBSTSPConst;
using XWG.Framework.MSException;
using System.Data;
namespace JWBSTAPP
{
    //[XWG.Framework.IAuthority.PermissionResource("JWBST", "ZHIAN")]
    public partial class TbBstOnlineAskManagement : JWBSTAPP.CommonClass.PageBases
    {
        protected void Page_Load(object sender, EventArgs e)
        {

            if (!IsPostBack)
            {
                //if (isPermission == true)
                //{
                string resid = Request.QueryString["ZJ"];
                string rescode = string.Empty;
                //查找资源编码
                XWG.Framework.AuthUtility.QueryByPage q = new XWG.Framework.AuthUtility.QueryByPage();
                DataTable dt = q.GetRecordByPage("*", " where RES_PVALUE like '%ZJ=" + resid + "%'", "", 1, 1, XWG.Framework.AuthSPConst.AppResouRceConst.TableName, XWG.Framework.AuthSPConst.AppResouRceConst.FieldKey, "").Tables[0];
                if (dt != null && dt.Rows.Count > 0)
                {
                    rescode = Convert.ToString(dt.Rows[0][XWG.Framework.AuthSPConst.AppResouRceConst.Columns.ResCode]);
                }
                List<string> list = new List<string>();
                list = ResPermission(rescode);
                List<string> listAll = new List<string>();
                listAll = Res(rescode);
                //控件级权限验证
                foreach (Control c in Page.Controls)
                {
                    if (listAll != null && listAll.Count > 0)
                    {
                        for (int j = 0; j < listAll.Count; j++)
                        {
                            if (c.UniqueID == listAll[j]) //具有权限
                            {
                                c.Visible = false;
                                break;
                            }
                        }
                    }
                }
                foreach (Control c in Page.Controls)
                {
                    if (list != null && list.Count > 0)
                    {
                        for (int i = 0; i < list.Count; i++)
                        {
                            if (c.UniqueID == list[i]) //具有权限
                            {
                                c.Visible = true;
                                break;
                            }
                        }
                    }
                }
            }

            //this.LoadComplete += new EventHandler(this.BasePage_Load);
            //}
        }
    }
}


